package com.harassment.interception.ui.fragments.listManagement.blackListFragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.harassment.interception.R;
import com.harassment.interception.ui.activities.main.MainActivity;
import com.harassment.interception.ui.fragments.bottomFragment.BottomBar;
import com.harassment.interception.ui.fragments.interceptRecord.phoneFragment.PhoneListAdapter;

public class BlackListFragment extends Fragment {
    private static final String TAG = "BlackListFragment";
    private RecyclerView mRecyclerView;
    private BlackListAdapter mBlackListAdapter;
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mBlackListAdapter == null) {
            MainActivity mainActivity = (MainActivity) getActivity();
            BottomBar bottomBar = mainActivity.getBottomBar();
            mBlackListAdapter = new BlackListAdapter(bottomBar,this);
        }
    }

    @Override
    public void onStart() {
        super.onStart();
        if (mRecyclerView == null) {
            mRecyclerView = getView().findViewById(R.id.base_recycler_view);
            mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
            mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(),DividerItemDecoration.VERTICAL));
            mRecyclerView.setAdapter(mBlackListAdapter);
        }
    }
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.base_recycler_view, container, false);
        return view;
    }

    public RecyclerView getRecyclerView() {
        return mRecyclerView;
    }

    public void setRecyclerView(RecyclerView recyclerView) {
        mRecyclerView = recyclerView;
    }

    public BlackListAdapter getBlackListAdapter() {
        return mBlackListAdapter;
    }

    public void setBlackListAdapter(BlackListAdapter blackListAdapter) {
        mBlackListAdapter = blackListAdapter;
    }
}
